﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;
using SStuff.WpfEffects;

namespace SStuff.WpfPlaneProjSample
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            //var rotationTransform = new RotateTransform3D();
            ////BindingOperations.SetBinding(planeProjection, PlaneProjectionEffect.PlaneTransformationProperty, new Binding { Path=new PropertyPath(Transform3D), Source = rotationTransform });
            //var animation = new Rotation3DAnimation(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0), new AxisAngleRotation3D(new Vector3D(0, 1, 0), 360), new Duration(TimeSpan.FromSeconds(2)), FillBehavior.Stop);
            //animation.Completed += delegate
            //{
            //    rotationTransform.BeginAnimation(RotateTransform3D.RotationProperty, animation);
            //};
            //animation.Changed+=delegate
            //{
            //    planeProjection.PlaneTransformation = rotationTransform.Value;
            //};
            //rotationTransform.BeginAnimation(RotateTransform3D.RotationProperty, animation);
        }

        private void Rectangle_MouseEnter(object sender, MouseEventArgs e)
        {
            Rectangle r = sender as Rectangle;
            r.Tag = r.Fill;
            r.Fill = Brushes.Red;
        }

        private void Rectangle_MouseLeave(object sender, MouseEventArgs e)
        {
            Rectangle r = sender as Rectangle;
            r.Fill = r.Tag as Brush;
        }
    }
}
